Ext.define('AmpleHarvest.objects.harvestMetadata.harvestdata',
		{
			extend			: 'Ext.grid.Panel',
			alias			: 'widget.ampleharvest-objects-harvestmetadata-harvestdata',
			iconCls			: 'toolbar-article-data',
			title			: 'Harvest Metadata',
			collapsible		: true,
			border			: 0,
			height			: 180,
			
			columns			: [
			       			   { header : 'Name', dataIndex : 'key', flex : 1 },
			       			   { header : 'Value', dataIndex : 'value', flex : 1 },
			       			   ],
			bodyStyle		: 'padding:5px;',
			requires		: [
			        		   		'AmpleHarvest.DATA.Store.cDataMetrics'
			        		   ],
			// MEMBER VARIABLES
			store				: Ext.create('AmpleHarvest.DATA.Store.cDataMetrics'),
			// PASSED MEMBER VARIABLES
			// REQUIRED
			m_str_data_source	: false,
			// OPTIONAL
			m_obj_params		: {},			

			listeners		:
			{
				dataResponse	: function(obj_response)
				{
					if(obj_response.success == "false")
					{
						this.destroy();
					}

					if(Ext.isArray(obj_response.data.keyValues))
					{
						this.getStore().loadRawData(obj_response.data.keyValues);
						this.AHcaller.fireEvent('objectResponse', this.m_str_keyID, this);
					} else {
						this.destroy();
					}
				},
				
				beforedestroy	: function(obj_self)
				{
					obj_self.m_obj_util.destroy();
				}
			},
			
			initComponent	: function()
			{
				if(this.m_str_data_source)
				{
					this.m_obj_util = Ext.create('AmpleHarvest.util.utility');
					this.m_obj_util.AHcaller = this;

					this.m_obj_util.getData(this.m_str_data_source, this.m_obj_params, {},'GET', {}, {});
				} else {
					this.html = "This object requires a resource path as m_str_data_source";
				}
					
				this.callParent();
			}
		});